package cn.me.alphamq.vo;

import java.time.Instant;

import static cn.me.alphamq.constant.ConsoleConstant.DATE_TIME_FORMATTER;

/**
 * 消费者的消费偏移量的信息的视图对象
 *
 * @author f
 */
public class ConsumerOffsetInfoVO {

    /**
     * 队列的 id
     */
    private Integer queueId;

    /**
     * 消费组的组名
     */
    private String consumerGroup;

    /**
     * 当前偏移量
     */
    private Integer offset;

    /**
     * 偏移量的限制
     */
    private Integer offsetLimit;

    /**
     * 创建时间
     */
    private String creatTime;

    /**
     * 更新时间
     */
    private String updateTime;

    public ConsumerOffsetInfoVO(Integer queueId, String consumerGroup, Integer offset, Integer offsetLimit,
                                long creatTime, long updateTime) {
        this.queueId = queueId;
        this.consumerGroup = consumerGroup;
        this.offset = offset;
        this.offsetLimit = offsetLimit;
        this.creatTime = DATE_TIME_FORMATTER.format(Instant.ofEpochMilli(creatTime));
        this.updateTime = DATE_TIME_FORMATTER.format(Instant.ofEpochMilli(updateTime));
    }

    public Integer getQueueId() {
        return queueId;
    }

    public void setQueueId(Integer queueId) {
        this.queueId = queueId;
    }

    public String getConsumerGroup() {
        return consumerGroup;
    }

    public void setConsumerGroup(String consumerGroup) {
        this.consumerGroup = consumerGroup;
    }

    public Integer getOffset() {
        return offset;
    }

    public void setOffset(Integer offset) {
        this.offset = offset;
    }

    public Integer getOffsetLimit() {
        return offsetLimit;
    }

    public void setOffsetLimit(Integer offsetLimit) {
        this.offsetLimit = offsetLimit;
    }

    public String getCreatTime() {
        return creatTime;
    }

    public void setCreatTime(String creatTime) {
        this.creatTime = creatTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }
}
